/*

Douglas Ahler	
Proposal title: The Social Construction of Partisanship: Misperceptions About Party Composition and Partisan Identification

HYPOTHESES

Stated-Hyp1: Asking people to give numerical estimates of the share of the party stereotypical groups
in the parties likely makes them confront the implausibly large numbers that stereotypes implicitly map to, and forces them to downwardly revise their beliefs... these lower estimates of shares of party-stereotypical groups would increase identification with parties, on average, across all respondents.

	Test-Hyp1: In the ask condition, compared to the control condition, all respondents will have higher levels of party identification.

Stated-Hyp2: The size of respondents’ misperceptions will moderate the treatment effect. That is, people with the most stereotype-inflated beliefs about their party’s composition will move the most after receiving the correct information, as the potential correction is the greatest for them.

	Test-Hyp2: For Democrats, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of atheists/agnostics. Higher the error, lower the level of identification.

	Test-Hyp3: For Democrats, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of millenials. Higher the error, lower the level of identification.

	Test-Hyp4: For Democrats, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of non-whites. Higher the error, lower the level of identification.
	
	Test-Hyp5: For Republicans, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of Evangelicals. Higher the error, lower the level of identification.

	Test-Hyp6: For Republicans, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of age 65+. Higher the error, lower the level of identification.

	Test-Hyp7: For Republicans, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of rich. Higher the error, lower the level of identification.
	
Stated-Hyp3: Treatment effects will vary by the degree to which people identify with party-stereotypical groups. For example, a non-wealthy, non-evangelical, urban or suburban Republican will be more likely to identify with the GOP after receiving the “tell” treatment; the respondent would learn that the party “looks more like him” than he previously thought.


	Test-Hyp8. Within Democrats, the effect of the tell condition compared to ask will be moderated by being atheist

	Test-Hyp9. Within Democrats, the effect of the tell condition compared to ask will be moderated by being millenial
	
	Test-Hyp10. Within Democrats, the effect of the tell condition compared to ask will be moderated by being non-white

	Test-Hyp11. Within Republicans, the effect of the tell condition compared to ask will be moderated by being Evangelical

	Test-Hyp12. Within Republicans, the effect of the tell condition compared to ask will be moderated by being age 65+
	
	Test-Hyp13. Within Republicans, the effect of the tell condition compared to ask will be moderated by being rich

	
********************************************************************************

NOTES: 
	
* Analysis is restricted to weak partisans:

Page 4: a survey experiment among weak partisans and partisan leaners (respondents
who put themselves on 2, 3, 5, or 6 on the a 7-point party identification scale in the
panel fle).

*/

use "Ahler870.dta", clear

********************************************************************************

* INDICATORS OF EXPERIMENTAL MANIPULATIONS

* is the sample restricted to weak partisans?
	tab PARTYID7
	// yes. only 2, 3, 5, 6 responses included

* party id
	* this is used to funnel people into democrat or republican treatment
	tab Q6A_INS, mis
	recode Q6A_INS (1=1) (2=0), gen(democrat)
	tab democrat, mis
	
* experiment condition
	tab P_TESS13
	recode P_TESS13 (1=1) (2=2) (3=0), gen(treat)
	lab def treat 1 "1 Ask" 2 "2 Tell" 0 "0 Control"
	lab val treat treat 
	tab treat, mis

	
* did R over-estimate?
	
	* Republican-stereotypical identities
		/*evangelical
		65+ years old
		earn > $250,000
		*/
	gen overest_evangelical=1 if Q2_R_A2==1
	replace overest_evangelical=0 if Q2_R_A3==1 |Q2_R_A1 ==1
	
	gen overest_old=1 if Q2_R_B2==1 
	replace overest_old=0 if Q2_R_B3==1| Q2_R_B1 ==1
	
	gen overest_rich=1 if Q2_R_C2==1
	replace overest_rich=0 if Q2_R_C3==1| Q2_R_C1==1
	
	* Democrat-stereotypical identities
			/*
		atheist/agnositc
		millenial (18-34 years)
		non-white
		*/
	gen overest_atheist=1 if Q2_D_A2 ==1
	replace overest_atheist=0 if Q2_D_A3==1| Q2_D_A1==1
	
	gen overest_millennial=1 if Q2_D_B2==1 
	replace overest_millennial=0 if Q2_D_B3==1|Q2_D_B1==1
	
	gen overest_nonwhite=1 if Q2_D_C2==1
	replace overest_nonwhite=0 if Q2_D_C3==1|Q2_D_C1==1
	
	lab def est 1 "1 overestimated" 0 "0 accurate/underest" 3 "3 Ask only"
	foreach var of varlist overest* {
		replace `var'=3 if treat==1
		lab val `var' est
	tab `var', mis
	}
	
* size of error (only applies to ask/tell condition)
	
	* combine values of resp estimates from both conditions
	foreach var in D R {
		gen `var'1	=	Q1_`var'_A1
		replace `var'1	=Q1_`var'_A2 if `var'1==.

		gen `var'2	=	Q1_`var'_B1
		replace `var'2	=Q1_`var'_B2 if `var'2==.
	
		gen `var'3	=	Q1_`var'_C1
		replace `var'3	=Q1_`var'_C2 if `var'3==.
		
		replace `var'1=. if `var'1>100
		replace `var'2=. if `var'2>100
		replace `var'3=. if `var'3>100		
		}
	
		tab D1
		tab D2
		tab D3
		
	* create error magnitude indicator

		/* Democrats
		atheist/agnositc = 14%
		millenial (18-34 years) = 30%
		non-white= 43%
		*/
		
	gen err_atheist = abs(D1-14)/.14 
	gen err_millennial = abs(D2-30)/.13 	
	gen err_nonwhite = abs(D3-43)/.43 		
		
	tab err_atheist	
	tab err_millennial
	tab err_nonwhite
	
		* Republicans 
		/*evangelical= 34%
		65+ years old=21%
		earn > $250,000=4%
		*/

	gen err_evangelical = abs(R1-34)/.34
	gen err_old = abs(R2-21)/.21 	
	gen err_rich = abs(R3-4)/.04
	
	tab err_evangelical
	tab err_old
	tab err_rich
	
	
* R's identity

	* Republican-stereotypical identities
		/*evangelical
		65+ years old
		earn > $250,000
		*/
		gen r_evangelical = 1 if BORN==1
		replace r_evangelical= 0 if BORN==2
		
		gen r_old = 1 if AGE7==6|AGE7==7
		replace r_old = 0 if AGE7>6
		
		gen r_rich = 1 if INCOME==18
		replace r_rich=0 if INCOME<18
			

	* Democrat-stereotypical identities
			/*
		atheist/agnositc
		millenial (18-34 years)
		non-white
		*/
		gen r_atheist=1 if RELIG==9|RELIG==10
		replace r_atheist=0 if RELIG<9 | (RELIG>10&RELIG<15)
		
		gen r_millennial= 1 if AGE7<=2
		replace r_millennial=0 if AGE7>2 & AGE7<10
		
		gen r_nonwhite= 1 if RACETHNICITY>1 & RACETHNICITY<6
		replace r_nonwhite=0 if RACETHNICITY==1



* OUTCOME
	
	* NOTE: q6-a had 4 response choices, but the other 3 questions have 5 response choices.
	
	* identification with party
	foreach var of varlist Q6_A Q6_B Q6_C Q6_D {
	replace `var'=. if `var'==77|`var'==98|`var'==99
	tab `var', mis
	}

	* when people criticize the party it upsets me
	clonevar id_criticize=Q6_A 
	
	* when I meet party members, I feel connected
	clonevar id_connected=Q6_B
	
	* I refer to party as "we" not "they"
	clonevar id_collective=Q6_C
	
	* when my party wins, I feel happy
	clonevar id_winhappy=Q6_D
	
	/* all variables are reverse-coded, re-coding so higher values indicate
	greater identification
	*/
	recode id_criticize (4=1) (3=2) (2=3) (1=4)
	foreach var of varlist id_connected id_collective id_winhappy {
	recode `var' (5=1) (4=2) (3=3) (2=4) (1=5)
	}
	
	foreach var of varlist id_* {
	tab `var', mis
	}
	
	* create summated scale of party identification
	gen identification = id_criticize+id_connected+id_collective+id_winhappy
	sum identification
	
********************************************************************************

* ANALYSIS
	

*Test-Hyp1: In the ask condition, compared to the control condition, all respondents will have higher levels of party identification.

	reg identification i.treat if treat!=2
		// reject Ho. 0.377
	tess 1.treat +, init(Ahler870) 
	
	
*Test-Hyp2: For Democrats, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of atheists/agnostics. Higher the error, lower the level of identification.

	reg identification c.err_atheist##i.treat if democrat==1&treat!=0
		// reject. 0.253
	
	tess 2.treat#c.err_atheist -
	
*Test-Hyp3: For Democrats, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of millenials. Higher the error, lower the level of identification.

	reg identification c.err_millennial##i.treat if democrat==1&treat!=0
		// reject. 0.229

	tess 2.treat#c.err_millennial -
		
*Test-Hyp4: For Democrats, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of non-whites. Higher the error, lower the level of identification.
	
	reg identification c.err_nonwhite##i.treat if democrat==1&treat!=0
	// reject.  0.747 
	tess 2.treat#c.err_nonwhite	-
	
	
*Test-Hyp5: For Republicans, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of Evangelicals. Higher the error, lower the level of identification.
	
	reg identification c.err_evangelical##i.treat  if democrat==0&treat!=0
	// reject.  0.690
	tess 2.treat#c.err_evangelical -
	

*Test-Hyp6: For Republicans, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of age 65+. Higher the error, lower the level of identification.

	reg identification c.err_old##i.treat if democrat==0&treat!=0
	// reject.  0.830
	tess 2.treat#c.err_old	-

*Test-Hyp7: For Republicans, the effect of the tell condition compared to ask will be moderated by the level of mis-perception about party composition of rich. Higher the error, lower the level of identification.

	reg identification c.err_rich##i.treat if democrat==0&treat!=0
	// reject.  0.681
	tess 2.treat#c.err_rich	-
	
*	Test-Hyp8. Within Democrats, the effect of the tell condition compared to ask will be moderated by being atheist
	reg identification i.r_atheist##i.treat if treat!=0 
	// reject. 0.823
	tess 2.treat#1.r_atheist 
	
*Test-Hyp9. Within Democrats, the effect of the tell condition compared to ask will be moderated by being millenial
	reg identification i.r_millennial##i.treat if treat!=0 
	// reject. 0.357
	tess 2.treat#1.r_millennial		
	
*Test-Hyp10. Within Democrats, the effect of the tell condition compared to ask will be moderated by being non-white
	reg identification i.r_nonwhite##i.treat if treat!=0 
	// reject. 0.774
	tess 2.treat#1.r_nonwhite		
	
*Test-Hyp11. Within Republicans, the effect of the tell condition compared to ask will be moderated by being Evangelical
	reg identification i.r_evangelical##i.treat if treat!=0 
	// reject. 0.822
	tess 2.treat#1.r_evangelical	
	
*Test-Hyp12. Within Republicans, the effect of the tell condition compared to ask will be moderated by being age 65+
	reg identification i.r_old##i.treat if treat!=0 
	// reject. 0.078
	tess 2.treat#1.r_old	
	
*Test-Hyp13. Within Republicans, the effect of the tell condition compared to ask will be moderated by being rich
	reg identification i.r_rich##i.treat if treat!=0 
	// reject. 0.428	
	tess 2.treat#1.r_rich	
